package com.rickpan.dto.request;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/**
 * AI聊天请求DTO
 */
public class ChatRequest {

    @NotBlank(message = "消息内容不能为空")
    @Size(max = 10000, message = "消息内容不能超过10000字符")
    private String message;

    @Size(max = 100, message = "模型名称不能超过100字符")
    private String model = "deepseek/deepseek-chat-v3-0324:free";

    // 图片生成相关字段
    private Boolean isImageGeneration = false;
    private String imageSize;
    private Integer batchSize;
    private Double guidanceScale;
    private Integer numInferenceSteps;
    private String image; // 参考图片（base64格式）

    // 图片理解相关字段
    private Boolean isImageUnderstanding = false; // 是否为图片理解请求
    private String uploadedImage; // 上传的图片（base64格式）用于理解

    // 构造函数
    public ChatRequest() {}

    public ChatRequest(String message, String model) {
        this.message = message;
        this.model = model;
    }

    // Getter 和 Setter 方法
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public Boolean getIsImageGeneration() {
        return isImageGeneration;
    }

    public void setIsImageGeneration(Boolean isImageGeneration) {
        this.isImageGeneration = isImageGeneration;
    }

    public String getImageSize() {
        return imageSize;
    }

    public void setImageSize(String imageSize) {
        this.imageSize = imageSize;
    }

    public Integer getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(Integer batchSize) {
        this.batchSize = batchSize;
    }

    public Double getGuidanceScale() {
        return guidanceScale;
    }

    public void setGuidanceScale(Double guidanceScale) {
        this.guidanceScale = guidanceScale;
    }

    public Integer getNumInferenceSteps() {
        return numInferenceSteps;
    }

    public void setNumInferenceSteps(Integer numInferenceSteps) {
        this.numInferenceSteps = numInferenceSteps;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Boolean getIsImageUnderstanding() {
        return isImageUnderstanding;
    }

    public void setIsImageUnderstanding(Boolean isImageUnderstanding) {
        this.isImageUnderstanding = isImageUnderstanding;
    }

    public String getUploadedImage() {
        return uploadedImage;
    }

    public void setUploadedImage(String uploadedImage) {
        this.uploadedImage = uploadedImage;
    }

    @Override
    public String toString() {
        return "ChatRequest{" +
                "message='" + message + '\'' +
                ", model='" + model + '\'' +
                ", isImageGeneration=" + isImageGeneration +
                ", isImageUnderstanding=" + isImageUnderstanding +
                ", imageSize='" + imageSize + '\'' +
                ", batchSize=" + batchSize +
                ", guidanceScale=" + guidanceScale +
                ", numInferenceSteps=" + numInferenceSteps +
                ", hasImage=" + (image != null && !image.isEmpty()) +
                ", hasUploadedImage=" + (uploadedImage != null && !uploadedImage.isEmpty()) +
                '}';
    }
}
